package com.ha.controller.user;

import com.ha.entity.News;
import com.ha.result.Result;
import com.ha.service.NewsService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName: NewsController
 * Package: com.ha.controller.user
 * Description:
 *
 * @Author 那啥啥
 * @Create 2024/5/3  22:41
 * @Version 1.0
 */
@RestController("UserNews")
@RequestMapping("/user/news")
@Api(tags = "用户端新闻")
@Slf4j
public class NewsController {

    @Autowired
    private NewsService newsService;
    @GetMapping
    public Result<List<News>> getNews(){

        log.info("请求新闻");
        List<News> list = newsService.getNews();
        return Result.success(list);

    }

}
